//
// Created by zhp on 2025/7/17.
//
#include <string> // string
#include <iostream>
#include <cstring> // strlen

void func1();

using namespace std;

int main() {
    string s = "test";
    cout << s[1] << endl << s << endl;

    func1();
}

void func1() {

    char a[5]{"abc"};
    char b[5];

    string c = "abcd";
    string d;

    // ===================copy===================
    // copy a to b
    strcpy(b, a);

    // copy c to d;
    d = c;

    cout << d << endl;

    // ===================contact===================
    // add zzz to end of a;
    strcat(a, "zzz");
    // add zzz to end of c;
    c += "zzz";

    // ===================length===================
    size_t a_size = strlen(a);
    size_t c_size = c.size();

    cout << "a size: " << a_size << endl;
    cout << "c size: " << c_size << endl;
}
